﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Forms;
using System.Xml;
using kad2SimSoft.Classes;
using kad2SimSoft.Resources.Lokalisierung;

namespace kad2SimSoft
{
    /// <summary>
    /// Interaktionslogik für XMLImportWindow.xaml
    /// </summary>
    public partial class XMLImportWindow : Window
    {
        ForecastControl _forcastWindow = null;
        String pathToXML;

        public XMLImportWindow()
        {
            InitializeComponent();

        }

        private void BrowseXMLFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.InitialDirectory = "C:\\";

            DialogResult result = dialog.ShowDialog();
            if (!dialog.FileName.Equals(""))
            {
                if (dialog.FileName.Contains("result") && dialog.FileName.Contains("xml"))
                {
                    pathToXML = dialog.FileName;
                    imgCheck.Visibility = System.Windows.Visibility.Visible;
                    bt_SelectXML.IsEnabled = false;
                    bt_ImportXMLFile.IsEnabled = true;
                }
                else
                {
                    System.Windows.MessageBox.Show(kad2SimSoft.Properties.Resources.msgWrongInputXml);
                }
            }
        }

        private void bt_ImportXMLFile_Click(object sender, RoutedEventArgs e)
        {
        //    kad2SimSoft.Properties.Settings.Default["XMLImportPath"] = pathToXML;
        //    kad2SimSoft.Properties.Settings.Default.Save();
        //    Xml xml = new Xml(true);
        //    _forcastWindow = new ForecastControl(xml.PurchasedParts, xml.ManufacturedParts, xml.Endproducts, xml.Orders, xml.WaitinglistStock, xml.WaitinglistWorkplace, xml.Workplaces, xml.OrdersInWork);
        //    //_forcastWindow.Show();
        }
    }
}